<script type="text/javascript">
//页面加载时执行
$(function(){
	array=[];//清空数组
	$.post("makeCardBatch/getCardCodeANDCompany",function(data){
		var contenta="<option value='' selected>请选择</option>";
		var contentb="<option value='' selected>请选择</option>";
		var contentc="<option value='' selected>请选择</option>";
		$(data).each(function(n,item){
			for(i=0;i<item.cdProDefinition.length;i++){
			contenta+="<option value="+item.cdProDefinition[i].cardpCode+">"
			+item.cdProDefinition[i].cardpName+"</option>"
		};
			for(i=0;i<item.companies.length;i++){
			contentb+="<option value="+item.companies[i].companyNo+">"
			+item.companies[i].companyName+"</option>"
		};
			for(i=0;i<item.banks.length;i++){
			contentc+="<option value="+item.banks[i].companyNo+">"
			+item.banks[i].companyName+"</option>"
		};
			$("#cardCodeByMakeCardBatch").html(contenta);
			$("#companies").html(contentb);
			$("#banks").html(contentc);
		});		
	},"json");
	$.post("tellerManage/getpaperAndBranch",function(json){
		 var contentb="<option value='' >请选择</option>";
		 $(json).each(function(n,item){
			for(i=0;i<item.branchs.length;i++){
				contentb+="<option value="+item.branchs[i].orgName+">"
				+item.branchs[i].orgName+"</option>"
			};
			$("#netDotByMakeCardBatch").html(contentb);
		 });
		
	 },"json")
	$.ajax({
		type: 'POST',
		url:"makeCardBatch/getMakeCardInfo",
		dataType:"json",
		cache: false,
		success: getMakeCardInfo,//回调函数
		error: DWZ.ajaxError
	});
	
	
	
});

//打开dialog
function openDialogTasking(a){
	//alert($(a).text());
	var parm=$(a).text()
	var options={"width":"500","height":"400","parm":parm};
	$.pdialog.open("makeCardBatch/infosByTasking","infos", "详细信息",options);
	
}
//验证复选框---------------------------------
function validateChechBox(){
	 if($("input[name='tasking']:checked").length < 1){
		 alertMsg.warn("您未选择数据！")
		 return false;
	 }
}
//生成任务提交表单-----------------------------
function comitFormByCreateTask(form){
	$form=$(form);
	 if (!$form.valid()) {
			return false;
		}
	 var companyCode=$("#companies").val();
	 var bankCode=$("#banks").val();
	 
	$.ajax({
		url:$form.attr("action"),
		 dataType:'json',
		 type:"post",
	 	 traditional:true,
	 	 data:{
	 		 "companyCode":companyCode,
	 		 "bankCode":bankCode,
	 		 "array":array,
	 	 },
	 	success:refresh
	})
	return false;
}
//生成任务后刷新页面
function refresh(json){
	$(json).each(function(n,item){
		if(item.statusCode=="200"){
			alertMsg.correct("任务生成成功!");
		}
	});
	$("#banks").removeAttr("disabled");
	$("#companies").removeAttr("disabled");
	$("#banks").val("");
	$("#companies").val("");
	array=[];//清空数组
	$.ajax({
		type: 'POST',
		url:"makeCardBatch/getMakeCardInfo",
		dataType:"json",
		data:$("#pagerForm").serialize(),
		cache: false,
		success: getMakeCardInfo,//回调函数
		error: DWZ.ajaxError
	});
};

</script>

<div class="pageHeader ">
	<form id="pagerForm" method="post"
		action="makeCardBatch/getMakeCardInfo"
		class="pageForm required-validate"
		onsubmit="return validateCallback(this,getMakeCardInfo);">
		<input type="hidden" name="pageNum" value="" /> <input type="hidden"
			name="numPerPage" value="" />
		<!-- <input type="hidden" name="pageCount" value="" /> -->
		<div class="searchBar">
			<!-- <table class="searchContent">
			<tr>
				<td style="text-align:left"><label>卡产品：</label></td>
				<td style="text-align:left"><select id="cardCodeByMakeCardBatch" name="cardPCode" >
			
				</select></td>
			
				<td style="text-align:left"><label>申请批次号：</label></td>
				<td style="text-align:left"><input  name="applyNo"  class="" type="text" size="30"  alt="请输入……"/></td>
			</tr>
			<tr>
				<td style="text-align:left"><label>工作单位：</label></td>
				<td style="text-align:left"><input  name="corpName" class="" type="text" size="30"  alt="请输入……"/></td>
			
				<td style="text-align:left"><label>网点：</label></td>
				<td style="text-align:left"><input  name="netDot" class="" type="text" size="30"  alt="请输入……"/></td>
			</tr>
			<tr>
				<td><label>申请日期(起)：</label></td>
				<td><input  name="startDate" class="date" type="text" size="30"  /></td>
			
				<td><label>申请日期(止)：</label></td>
				<td><input  name="endDate" class="date" type="text" size="30" /></td>
			</tr>
			</table> -->
			<div class="row" style="padding: 0 10px;">
				<div class="col-md-6 col-sm-12">
					<p>
						<label>卡产品：</label> <select id="cardCodeByMakeCardBatch"
							name="cardPCode"></select>
					</p>
				</div>
				<div class="col-md-6 col-sm-12">
					<p>
						<label>申请批次号：</label><input name="applyNo" class="validApplyNo" type="text"
							size="26" />
					</p>
				</div>
			</div>
			<div class="row" style="padding: 0 10px;">
				<div class="col-md-6 col-sm-12">
					<p>
						<label>工作单位：</label><input name="corpName" class="" type="text"
							size="26" />
					</p>
				</div>
				<div class="col-md-6 col-sm-12">
					<p>
						<label>申请网点：</label> <select id="netDotByMakeCardBatch" name="netDot" 
							></select>
					</p>
				</div>
			</div>
			<div class="row" style="padding: 0 10px;">
				<div class="col-md-6 col-sm-12">
					<p>
						<label>申请日期(起)：</label><input name="startDate" class="date validDateFrom"
							type="text" size="26" />
					</p>
				</div>
				<div class="col-md-6 col-sm-12">
					<p>
						<label>申请日期(止)：</label><input name="endDate" class="date validDateTo"
							type="text" size="26" />
					</p>
				</div>
			</div>
			<div class="subBar">
				<ul>
					<li>
						<div class="buttonActive">
							<div class="buttonContent">
								<button id="queryMakeCardInfo" type="submit" onclick="initCurrentPage()">查询</button>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>
	</form>
</div>

<form method="post" action="makeCardBatch/createTask"
	onsubmit="return comitFormByCreateTask(this);"
	class="pageForm">
	<!-- <input id="bankName" name="bankName" type="hidden" value="">
		<input id="companyName" name="companyName" type="hidden" value=""> -->
	<div class="pageContent">
		<!-- <input name="tasking" type="checkbox" style="display:none" value="xxxxxxxxxxx" checked> -->
		<div id="ByMakeCardBatch">
			<table class="table" width="100%" layoutH="298">
				<thead>
					<tr align="center">
						<th width="2%"><input type="checkbox"
							onclick="checkAllSave(this)" id="ids" name="" group="tasking"
							class="checkboxCtrl"></th>
						<th width="10%">申请批次号</th>
						<th width="18%">申请网点</th>
						<th width="15%">卡产品</th>
						<th width="10%" class="asc" onclick="order($('#tbodyByBatch'),4)">数量</th>
						<th width="15%">申请日期</th>
						<th width="20%">工作单位</th>
						<th width="10%">备注(是否加急)</th>
					</tr>
				</thead>
				<tbody id="tbodyByTasking">

				</tbody>
			</table>
		</div>
		<!--  <div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select id="numPerPageByTasking" name="numPerPage" onchange="paging(this,$('#getMakeCardInfo'),getMakeCardInfo)">
				<option value="20">20</option>
				<option value="30">30</option>
				<option value="50">50</option>
				<option value="100">100</option>
			</select>
			<span id="totalCountByTasking" ></span>
		</div>
			<div id="paginationByTasking" class="pagination1"  ></div>
	</div> -->
		<div class="panelBar">
			<div class="pages">
				<span>显示</span> <select class="combox" name="numPerPage"
					onchange="navTabPageBreak({numPerPage:this.value},'tbodyByTasking',getMakeCardInfo)">
					<option value="20">20</option>
					<option value="50">50</option>
					<option value="100">100</option>
					<option value="200">200</option>
				</select> <span id="totalCountByTasking">条，共${totalCount}条</span>
			</div>

			<div callback='getMakeCardInfo' id="paginationByTasking"
				rel="tbodyByTasking" class="pagination" targetType="navTab"
				totalCount="200" numPerPage="5" pageNumShown="5" currentPage="1"></div>

		</div>
		<div class="pageFormContent" id="makeCardCompany">
			<p>
				<label>制卡商：</label> <select id="companies" name="companyCode"
					class="validRequired">

				</select>
			</p>
			<p>
				<label>合作银行：</label> <select id="banks" name="bankCode"
					class="validRequired">

				</select>
			</p>
			<div class="formBar">
				<ul>
					<li>
						<div class="buttonActive">
							<div class="buttonContent">
								<button id="subTask" onclick="return validateChechBox();"
									type="submit" class="valid">生成制卡任务</button>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>
	</div>
</form>


